<?php
/*
Chương trình: "Quản lý Hóa Đơn và in hóa đơn Trường Thành"
Tác giả: "Lê Phương"
Phiên bản: "1.0"
Tệp tin: "show.tpl.php"
*/
if(defined("template")!=true)
{
	die('Template not found!');
}
if($prdata->quantity != 0){
	$so_tren_quyen = ($prdata->quantity_d - $prdata->quantity_t + 1) / $prdata->quantity;
	$tu_so_quyen = ($prdata->quantity_t - 1) / $so_tren_quyen + 1;
	$den_so_quyen = $prdata->quantity_d / $so_tren_quyen;
}
else{
	$so_tren_quyen = 0;
	$tu_so_quyen = '';
	$den_so_quyen = '';
}
?>
<style>
td.print_<?=$prdata->id?> { 
	background:#def3ca; 
	margin:3px; 
	width:180px; 
	display:none; 
	text-align:center; 
}
</style>
<script language="JavaScript" type="text/javascript">
	function alert_print_<?=$prdata->id?>()
	{
		confirm('Xem lại cho đúng phôi bìa <?=$vat_type?> chưa?');
		return true;
	}
</script>
<tr height="40" align="center" class="odd" id="print_s_<?=$prdata->id?>">
	<td><?=$rsid?></td>
	<td width="2%">
		<a href="home.php?menu=manage&edit=<?=$prdata->id?>"><img src="template/images/b_edit.png" border="0"></a>
	</td>
	<td><b><?=$rsdata->name?></b></td>
	<td><b><?=$rsdata->tax?></b></td>
	<td><?=$rsdata->address?></td>
	<td><?=$prdata->form?></td>
	<td><?=$prdata->serial?></td>
</tr>
<tr align="center">	
	<td colspan="7" class="print_<?=$prdata->id?>">
		<form action="home.php" name="form_<?=$prdata->id?>" method="GET">
		<input type="hidden" name="menu" value="print">
		<input type="hidden" name="id" value="<?=$prdata->id?>">
		<input type="hidden" name="name" value="<?=$rsdata->name?>">
		<input type="hidden" name="tax" value="<?=$rsdata->tax?>">
		<input type="hidden" name="address" value="<?=$rsdata->address?>">
		<input type="hidden" name="form" value="<?=$prdata->form?>">
		<input type="hidden" name="serial" value="<?=$prdata->serial?>">
		<table class="border" align="center" width="560">
			<tr>
				<td class="fr_2" colspan="2" align="center"><?=$phase['program_name']?></td>
			</tr>
			<tr>
				<td class="fr_2"><?=$phase['book_number']?></td>
				<td class="fr"><input type="text" name="soquyen" id="soquyen" size="50" /></td>
			</tr>
			<tr>
				<td class="fr_2"><?=$phase['book_no']?></td>
				<td class="fr"><input type="text" name="quyenso" id="quyenso" size="50" /></td>
			</tr>
			<tr>
				<td class="fr_2"><?=$phase['book_folow']?></td>
				<td class="fr">
					<?=$phase['from_book']?><input type="text" name="tuquyen" id="tuquyen" value="<?=$tu_so_quyen?>" size="10" />
					<?=$phase['to_book']?><input type="text" name="denquyen" id="denquyen" value="<?=$den_so_quyen?>" size="10" />
				</td>
			</tr>
			<tr>
				<td class="fr_2"><?=$phase['no_folow']?></td>
				<td class="fr">
					<?=$phase['from_no']?><input type="text" name="tuso" id="tuso" size="10" />
					<?=$phase['to_no']?><input type="text" name="denso" id="denso" size="10" />
				</td>
			</tr>
			<tr>
				<td class="fr_2">Kiểu in</td>
				<td class="fr">
					<label><input type="radio" name="paper_type" value="A4" checked /> In bìa A4</label>&nbsp;&nbsp;&nbsp;
					<label><input type="radio" name="paper_type" value="A5" /> In bìa A5</label>
				</td>
			</tr>
			<tr>
				<td align="left" width="20%">
					<span style="padding:left;"><input id="print_h_<?=$prdata->id?>" type="reset" value="Cancel"></span>
				</td>
				<td align="right" width="40%">
				  <input id="print_h_<?=$prdata->id?>" type="submit" name="print_submit" value="Print" onclick="this.form.target='_blank';return alert_print_<?=$prdata->id?>();">
			    </td>
			</tr>
		</table>
		</form>
	</td>
</tr>
<script>
var flip = 0;
$("#print_s_<?=$prdata->id?>").click(function () {
$(".print_<?=$prdata->id?>").toggle( flip++ % 2 == 0 );
});
$("#print_h_<?=$prdata->id?>").click(function () {
  $(".print_<?=$prdata->id?>").hide(20);
});
</script>
